/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package chelydra.sharelydra.client.network;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Benjamin
 */
public class InputSocket extends Thread {


public int LocalPort;
public Reciever reciever;
public ServerSocket ss;


public InputSocket(int LocalPort) throws IOException{
    this.LocalPort=LocalPort;
    this.ss=new ServerSocket(LocalPort);
}

    @Override
public void run(){
    Socket tempSock;
    while(true){
            try {
                tempSock=ss.accept();
                //Accept a connection and give the relay to a newly created threaded reciever.
                System.out.println("Connection accepted");
                new Reciever(tempSock).start();

            } catch (IOException ex) {
                Logger.getLogger(InputSocket.class.getName()).log(Level.SEVERE, null, ex);
            }
    }
}
}
